<template>
  <div>
    <div id="lineChart" style="width:100%;height:100%"></div>
  </div>
</template>
<script>
  import echarts from 'echarts'

  export default {
    name: 'lineChart',
    data() {
      return {

      }
    },
    props: {
      chartOptions: Object,
      chartVisible: Object,
      // chartData:Array
    },
    methods: {
      initChart() {
        console.log(this.chartOptions);
        let option = this.$changeChart.toLinechartData(this.chartOptions);
        console.log(option);

        const lineChart = echarts.init(document.getElementById('lineChart'));
        lineChart.setOption(option);

        window.addEventListener('resize', function () {
          lineChart.resize()
        })
      }
    },
    mounted() {
      this.initChart();
    },
    created() {
      this.$Bus.$on('dataEmit', (e) => {
        this.chartOptions = e;
      });
      // console.log(this.chartData)
    },
  }
</script>
